<template>
  <div class="latelyCourseBox">
    <div class="minBBox" v-for="(item, index) of lately" :key="index">
      <div class="latelyCourseTop">
        <img :src="item.pic" alt="" />
      </div>
      <div class="latelyCourseBtm">{{ item.name }}</div>
    </div>
  </div>
</template>

<script>
import { get } from "@/utils/http.js";
export default {
  data() {
    return {
      lately: [],
    };
  },
  async mounted() {
    this.$nextTick(async function () {
      this.lately = this.$store.state.mySession.lately.map(async (item) => {
        // console.log(get(`/session/detail/${item}`));
        let res = await get(`/session/detail/${item}`);
        let data = await res;
        // console.log(data);
        return {
          name: data.intro.name,
          pic: data.intro.detail.pic,
        };
      });
      //   console.log(this.lately)

      Promise.all(this.lately).then((arr) => {
        this.lately = arr;
      });
    });
  },
};
</script>

<style lang="scss" scoped >
.latelyCourseBox {
  margin-left: 20px;
  .minBBox {
    margin-top: 15px;
    margin-right: 15px;
  }
  display: flex;
  .latelyCourseBtm {
    margin-top: 5px;
    width: 100px;
    height: 35px;
    font-size: 13px;
  }
}
.latelyCourseTop {
  margin-bottom: 10px;
  width: 100px;
  height: 70px;
  background-color: aquamarine;
  border-radius: 10px;
  img {
    width: 100%;
    height: 100%;
    border-radius: 10px;
  }
}
</style>